package com.aube.control;

import android.content.Context;

import com.aube.model.TimeLinePiece;
import com.aube.views.BaseCardNew;
import com.aube.views.CardPicNew;
import com.aube.views.CardQANew;
import com.aube.views.CardVSNew;
import com.aube.views.CardVoteNew;
import com.huyn.baseframework.model.ChannelDetail;

/**
 * Created by huyaonan on 16/3/18.
 */
public class ViewGenerator {

    public static BaseCardNew getView(TimeLinePiece data, ChannelDetail channelDetail, Context context) {
        String type = data.type;
        BaseCardNew card = null;
        if (TimeLinePiece.TYPE_VOTE.equalsIgnoreCase(type)) {
            card = new CardVoteNew(context);
        } else if (TimeLinePiece.TYPE_VS.equalsIgnoreCase(type)) {
            card = new CardVSNew(context);
        } else if (TimeLinePiece.TYPE_QA.equalsIgnoreCase(type)) {
            card = new CardQANew(context);
        } else if (TimeLinePiece.TYPE_PIC.equalsIgnoreCase(type)) {
            card = new CardPicNew(context);
        }

        if(card != null)
            card.init(data, channelDetail);
        return card;
    }

}
